Chapter 6. B-Tree Variants
Copy-on-Write
Copy-on-write never changes an existing page. It writes a replacement page and keeps references to unaffected pages, so readers can continue using the old version safely. LMDB, a key-value database, uses this approach. It reduces the need to coordinate readers with writers over shared buffers.
Lazy B-Trees (WiredTiger/MongoDB)
A lazy B-tree collects changes in an update buffer before writing them to disk pages. Reads combine the buffered changes with the cached page; a background thread later merges them, reducing direct competition with foreground reads and writes.
Lazy Adaptative B-Tree
This approach does the same Lazy B-Tree but to a group of nodes, named subtree. Buffering updates to this subtrees and applying only on those.
- How does read operations happen in LA B-Trees? Seems to be expensive per BW-Tree.
Flash-Disk Tree ( FD-Tree)
I honestly didn't grasp much about this Tree variant.
BW Tree (Buzzword Tree)
The Bw-tree avoids in-place updates by prepending delta nodes—small insert or update records—to a base node through a linked list. A read follows that chain to reconstruct the current page. Nodes are now logical entities. During read, now we need to traverse the entire node LinkedList to construct the node final-state.
This is somewhat similar to what LA-Trees do (see “Lazy-Adaptive Tree”): keeping updates separate from the main structure and replaying them on read.
Petrov, Alex. Database Internals (p. 192). O'Reilly Media. Edição do Kindle.
Examples of BWTrees
Cache Oblivious B-Tree
- Not being used in production by any database
- No implementation outside of academic Creates a Two Level Memory model for all storage - enabling for platform specific configurations but creating something more general.
Take Away Points:
- B-Trees are not perfect and have a lot of downsides
- Wired Tigers uses Lazy B-Trees
Further reads
- Making DS persistent https://dx.doi.org/10.1016/0022-0000(89)90034-2.
- “Lazy-Adaptive Tree: an optimized index structure for flash devices" https://doi.org/10.14778/1687627.1687669.
- “Tree Indexing on Solid State Drives" https://doi.org/10.14778/1920841.1920990.
- “Building a Bw-Tree Takes More Than Just Buzz Words.” https://doi.org/10.1145/3183713.3196895
- “The Bw-Tree: A B-tree for new hardware platforms.” https://doi.org/10.1109/ICDE.2013.6544834.
- “Cache-Oblivious B-Trees.” https://doi.org/10.1137/S0097539701389956.